package com.jsmile.cloud.taskcenter.task.model;

import java.util.Date;

import javax.validation.constraints.NotBlank;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 龚亮
 * @version 1.0
 * @desc 为了薪资破万，还是睡一会儿吧...!
 * @date 2019年04月01日 05:06:10
 */
@ApiModel
@Data
@TableName("t_task")
public class TaskModel extends Model<TaskModel> {

    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;
    @ApiModelProperty("任务名称")
    @NotBlank(message = "任务名称不能为空")
    private String jobName;
    @ApiModelProperty("任务名称")
    @NotBlank(message = "任务名称不能为空")
    private String jobGroup;
    @ApiModelProperty("cron表达式")
    @NotBlank(message = "cron表达式不能为空")
    private String cron;
    @ApiModelProperty("beanClass")
    @NotBlank(message = "beanClass不能为空")
    private String beanClass;
    /**
     * desc: 是否有状态 1有 0无
     */
    private Integer status;
    /**
     * desc: 任务状态 1正常 0暂停
     */
    private Integer taskStatus;
    @ApiModelProperty("任务类型  1周期任务 2定时任务")
    @NotBlank(message = "任务类型不能为空")
    private String taskType;
    private String remark;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;
    @ApiModelProperty(value = "0:正常，1:删除")
    private Integer delFlag;
    @ApiModelProperty(value = "创建者")
    private String createBy;
    @ApiModelProperty(value = "修改者")
    private String updateBy;

    public static TaskModel init(String jobName, String jobGroup, String cron, String beanClass) {
        TaskModel taskModel = new TaskModel();
        taskModel.jobName = jobName;
        taskModel.jobGroup = jobGroup;
        taskModel.cron = cron;
        taskModel.beanClass = beanClass;
        taskModel.taskStatus = 1;
        taskModel.status = 0;
        return taskModel;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getJobGroup() {
        return jobGroup;
    }

    public void setJobGroup(String jobGroup) {
        this.jobGroup = jobGroup;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }

    public String getBeanClass() {
        return beanClass;
    }

    public void setBeanClass(String beanClass) {
        this.beanClass = beanClass;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getTaskStatus() {
        return taskStatus;
    }

    public void setTaskStatus(Integer taskStatus) {
        this.taskStatus = taskStatus;
    }

    public String getTaskType() {
        return taskType;
    }

    public void setTaskType(String taskType) {
        this.taskType = taskType;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
